/// 编辑活动响应模型
class ActivityEditResponse {
  final String status;
  final String message;
  final ActivityEditData? data;

  ActivityEditResponse({
    required this.status,
    required this.message,
    this.data,
  });

  bool get isSuccess => status == 'success';

  factory ActivityEditResponse.fromJson(Map<String, dynamic> json) {
    // 调试信息：打印原始JSON
    print('🔍 ActivityEditResponse 解析原始JSON: $json');
    
    return ActivityEditResponse(
      status: json['status'] ?? 'error',
      message: json['message'] ?? '未知错误',
      data: json['data'] != null ? ActivityEditData.fromJson(json['data']) : null,
    );
  }

  Map<String, dynamic> toJson() {
    return {
      'status': status,
      'message': message,
      'data': data?.toJson(),
    };
  }
}

/// 编辑活动响应数据
class ActivityEditData {
  final int? activityId;
  final String? activityTitle;
  final String? updatedAt;
  final Map<String, dynamic>? updatedFields;

  ActivityEditData({
    this.activityId,
    this.activityTitle,
    this.updatedAt,
    this.updatedFields,
  });

  factory ActivityEditData.fromJson(Map<String, dynamic> json) {
    return ActivityEditData(
      activityId: json['activityId'] ?? json['activity_id'],
      activityTitle: json['activityTitle'] ?? json['activity_title'],
      updatedAt: json['updatedAt'] ?? json['updated_at'],
      updatedFields: json['updatedFields'] ?? json['updated_fields'],
    );
  }

  Map<String, dynamic> toJson() {
    return {
      'activityId': activityId,
      'activityTitle': activityTitle,
      'updatedAt': updatedAt,
      'updatedFields': updatedFields,
    };
  }
}
